// pages/text/text.js
var app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    docId:0,
    info:{},
  },

//图文咨询  
tu:function(e){
  var docid = e.currentTarget.dataset.docid;
  var price = e.currentTarget.dataset.price;
   wx.navigateTo({
     url: '../balance/balance?docId=' + docid + '&price=' + price,
   })
},
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this;
    var docId = options.docId;
    that.setData({
      docId: docId
    });
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    var that = this;
    var docId = that.data.docId;
    wx.request({
      url: app.api.hostUrl + '/Api/Doctor/details',
      method: 'post',
      data: {
        docid: docId
      },
      header: {
        'Content-Type': 'application/x-www-form-urlencoded'
      },
      success: function (res) {
        var status = res.data.status;
        var info = res.data.info;
        if (status == 1) {
          that.setData({
            info: info,
          });
        } else {
          wx.showToast({
            title: '数据信息异常！',
            duration: 2000
          });
        }
      },
      fail: function (e) {
        wx.showToast({
          title: '网络异常！',
          duration: 2000
        });
      },
    })
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  },

  //拨打电话
  calling: function (e) {
    var tel = e.currentTarget.dataset.tel;
    wx.makePhoneCall({
      phoneNumber: tel, 
      success: function () {
        console.log("拨打电话成功！")
      },
      fail: function () {
        console.log("拨打电话失败！")
      }
    })
  }
})